home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / cmln0286.arc / DRIVER.C < prev    next >
Text File  |  1986-02-03  |  2KB  |  73 lines

  1. THOMAS D. WEBB  Listing Three, Page 1 of 2
  2.  
  3.  
  4.   1: /*------------------------------DRIVER.C-----------------------------------
  5.   2: *  DRIVER.C  Routines to illustrate the use of the symbolic debugger.
  6.   3: *
  7.   4: *
  8.   5: *------------------------------------------------------------------------*/
  9.   6: #include <stdio.h>
  10.   7: #include <debug.h>
  11.   8: /*-----------------------------------------------------------------------*/
  12.   9: func2()       /* this illustrates a typical application of the debugger: */
  13.  10: {             /* 1. record the entry into a function */
  14.  11:               /* 2. record the program variables as they change */
  15.  12:               /* 3. record the exit from the function */
  16.  
  17.  13:   int small_number;
  18.  14:   long big_number;
  19.  
  20.  15:   TS("enter func2","-------------------");
  21.  
  22.  16:   for (small_number = 0, big_number = 0L; small_number < 5; small_number++)
  23.  17:       {
  24.  18:          big_number += small_number *10;
  25.  19:          TI("small_number:",small_number);
  26.  20:          TL("big_number:", big_number);
  27.  21:       }
  28.  22:   TS("exit func2","^^^^^^^^^^^^^^^^^^^");
  29.  
  30.  23: } /*func2*/
  31.  24: /*-----------------------------------------------------------------------*/
  32.  25: func1()            /*illustrate the use of all of the types of traces*/
  33.  26: {
  34.  27:   char a = 'A';
  35.  28:   int j = 123;
  36.  29:   int *j_ptr = &j;
  37.  30:   long k = 456789;
  38.  31:   float f = 12.978;
  39.  32:   static char string[] = "hello, world";
  40.  
  41.  33:   TS("enter func1","-------------------");
  42.  
  43.  34:   TC("Character test",a);
  44.  35:   TI("Integer test",j);
  45.  36:   TL("Long test",k);
  46.  37:   TU("Unsigned test",j_ptr);
  47.  38:   TF("Float test",f);
  48.  39:   TD("Double test",123456.789012);
  49.  40:   TS("String test",string);
  50.  
  51.  41:   TS("exit func1","^^^^^^^^^^^^^^^^^^^^");
  52.  
  53.  42: } /*func1*/
  54.  43: /*-----------------------------------------------------------------------*/
  55.  
  56. THOMAS D. WEBB  Listing Three, Page 2 of 2
  57.  
  58.  
  59.  44: main()
  60.  45: {
  61.  46:   printf("Debug driver version 02 start\n");
  62.  
  63.  47:   printf("Press F10 to start trace\n");
  64.  48:   inkey();
  65.  
  66.  49:   func1();
  67.  50:   func2();
  68.  
  69.  51:   printf("Debug driver end\n");
  70.  52: } /*main*/
  71.  53: /*--------------------------END DRIVER.C---------------------------------*/
  72.                                                     End Listing Three
  73.